package com.czwj.timetask;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.czwj.entities.Camera;
import com.czwj.service.CameraService;


@Component
@Configuration
@EnableScheduling
public class EnvironmentTimerTask{
	@Resource
	CameraService cameraService;
	
	@Scheduled(cron = "0 0 0 * * ?")
	public void clear(){
		List<Camera> list = cameraService.search(null);
		for(Camera camera:list){
			camera.setDailytime("0");
			cameraService.update(camera);
		}
	}
}
